emacs.git
2 years agoDelete compat code in `url` library
Stefan Kangas [Sun, 4 Feb 2024 09:28:40 +0000 (10:28 +0100)]
Delete compat code in `url` library

* lisp/url/url-cid.el (url-cid): Delete compat code for ancient Gnus.
* lisp/url/url-ldap.el (url-ldap-certificate-formatter): Delete compat
code; ssl.el has never been in Emacs.
* lisp/url/url-mailto.el (url-mail): Make into alias for 'message-mail',
since it is always fboundp.

2 years agoAdd alias progress-reporter-make
Stefan Kangas [Sun, 4 Feb 2024 09:28:18 +0000 (10:28 +0100)]
Add alias progress-reporter-make

* lisp/subr.el (progress-reporter-make): New alias for
'make-progress-reporter'.

2 years ago; Fix typos
Stefan Kangas [Sun, 4 Feb 2024 08:48:04 +0000 (09:48 +0100)]
; Fix typos

2 years agoFix display of invisible text with opposite directionality
Eli Zaretskii [Sun, 4 Feb 2024 09:45:15 +0000 (11:45 +0200)]
Fix display of invisible text with opposite directionality

* src/xdisp.c (handle_invisible_prop): Skip invisible text
correctly when it starts at position whose resolved bidi level is
above the base paragraph level.  (Bug#68446)

2 years agotramp: Tweak the ls-lisp declarations
Stefan Monnier [Sun, 4 Feb 2024 04:05:03 +0000 (23:05 -0500)]
tramp: Tweak the ls-lisp declarations

* lisp/net/tramp-sh.el (ls-lisp-use-insert-directory-program): Don't
declare its existence...
(tramp-sh-handle-insert-directory): ...test it instead.

* lisp/net/tramp.el (ls-lisp-dirs-first, ls-lisp-emulation)
(ls-lisp-ignore-case, ls-lisp-use-insert-directory-program)
(ls-lisp-verbosity): Move declaration...
(tramp-handle-insert-directory): ...to the point where we have a good
reason to think these variables exist.

2 years ago* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Add comment
Stefan Monnier [Sat, 3 Feb 2024 23:22:41 +0000 (18:22 -0500)]
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring): Add comment

2 years ago* doc/emacs/buffers.texi (List Buffers): Update example
Stefan Monnier [Sat, 3 Feb 2024 23:22:05 +0000 (18:22 -0500)]
* doc/emacs/buffers.texi (List Buffers): Update example

2 years agobytecomp.el: Warn for `,' not within backquote construct
Richard M Stallman [Sat, 3 Feb 2024 22:47:02 +0000 (17:47 -0500)]
bytecomp.el: Warn for `,' not within backquote construct

(bytecomp--report-comma): New function with `compiler-macro' property.

2 years agotextconv.c: Fix warnings with-wide-int
Stefan Monnier [Sat, 3 Feb 2024 21:07:24 +0000 (16:07 -0500)]
textconv.c: Fix warnings with-wide-int

* src/textconv.c (set_composing_region, textconv_set_point_and_mark):
Use `min/max`.

2 years ago; * lisp/files.el (hack-local-variables--find-variables): Fix comment.
Eli Zaretskii [Sat, 3 Feb 2024 16:09:35 +0000 (18:09 +0200)]
; * lisp/files.el (hack-local-variables--find-variables): Fix comment.

2 years ago; Fix a comment in loaddefs-gen.el
Eli Zaretskii [Sat, 3 Feb 2024 16:05:55 +0000 (18:05 +0200)]
; Fix a comment in loaddefs-gen.el

2 years ago; Optimize shorthand insertion in loaddefs-generate--parse-file
Joseph Turner [Sat, 3 Feb 2024 14:32:37 +0000 (08:32 -0600)]
; Optimize shorthand insertion in loaddefs-generate--parse-file

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
Optimize.

2 years ago; Also consider shorthands in check-declare-scan (bug#67523)
João Távora [Sat, 3 Feb 2024 14:27:27 +0000 (08:27 -0600)]
; Also consider shorthands in check-declare-scan (bug#67523)

* lisp/emacs-lisp/check-declare.el (check-declare-scan): Also
consider shorthands here.

2 years agoFix prefix discovery for files with read-symbol-shorthands (bug#67325)
João Távora [Thu, 30 Nov 2023 13:32:50 +0000 (07:32 -0600)]
Fix prefix discovery for files with read-symbol-shorthands (bug#67325)

In a previous commit, the local-variable read-symbol-shorthands is
already read into the temporary buffer used for the autoload parsing
aerobatics, so all we needed to do in 'l-g--compute-prefixes' is
use 'read' to give 'read-symbol-shorthands' a chance to kick in.

* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--compute-prefixes):

2 years agoAlso teach loaddefs-gen.el about shorthands (bug#63480)
João Távora [Thu, 30 Nov 2023 02:09:57 +0000 (20:09 -0600)]
Also teach loaddefs-gen.el about shorthands (bug#63480)

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
Make aware of read-symbol-shorthands.

2 years agoImprove shorthands-font-lock-shorthands (bug#67390)
João Távora [Wed, 29 Nov 2023 22:48:34 +0000 (16:48 -0600)]
Improve shorthands-font-lock-shorthands (bug#67390)

Add font locking to the shorthand prefix of a given printed symbol
name by checking if any of the shorthand prefixes in
read-symbol-shorthands are a prefix for that print name.  Although
this does more string comparisons, it didn't prove to be any slower
than the existing approach, and is more correct.

This version is more accurate when highlighting files with many
overlapping shorthands.   Given:

;; Local Variables:
;; read-symbol-shorthands: (("bc-" . "breadcrumb-")
;;                          ("aw-" . "ace-window-")
;;                          ("zorglub/" . "ace-window-")
;;                          ("he//" . "hyperdrive-entry--")
;;                          ("h//"  . "hyperdrive--")
;;                          ("he/"  . "hyperdrive-entry-")
;;                          ("h/"   . "hyperdrive-"))
;; End:

The following are correct highlights on print names

'(zorglub/blerh ; hilits "zorglub/" reads to 'ace-window-blerh'
  he/foo        ; hilits "he/"      reads to 'hyperdrive-entry-foo'
  he//bar       ; hilits "he//"     reads to 'hyperdrive-entry--bar'
  h/coiso       ; hilits "h/"       reads to 'hyperdrive-coiso'
  h//thingy     ; hilits "h//"      reads to 'hyperdrive--thingy'
  bc-yo         ; hilits "bc-"      reads to 'breadcrumb-yo'
  aw-thingy     ; hilits "aw-"      reads to 'ace-window-thingy'
  )

Co-authored-by: Jonas Bernoulli <jonas@bernoul.li>
Co-authored-by: Joseph Turner <joseph@ushin.org>
* lisp/emacs-lisp/shorthands.el (shorthands-font-lock-shorthands):

2 years agoConsider read-symbol-shorthands in check-declare.el (bug#67523)
João Távora [Wed, 29 Nov 2023 12:21:29 +0000 (06:21 -0600)]
Consider read-symbol-shorthands in check-declare.el (bug#67523)

* lisp/emacs-lisp/check-declare.el (check-declare-verify):
Consider read-symbol-shorthands.

2 years agoProcess read-symbol-shorthands from longest to shortest (bug#67390)
João Távora [Thu, 30 Nov 2023 12:00:38 +0000 (06:00 -0600)]
Process read-symbol-shorthands from longest to shortest (bug#67390)

This ensures that overlapping shorthands are handled correctly and
consistently even if specified out-of-order by the user.

* doc/lispref/symbols.texi (Shorthands): Describe shorthand sort
order.

* lisp/files.el (hack-local-variables--find-variables): Specially
handle read-symbol-shorthands.

2 years agoMake sure read-symbol-shorthands is permanently local
João Távora [Thu, 30 Nov 2023 12:00:44 +0000 (06:00 -0600)]
Make sure read-symbol-shorthands is permanently local

bug#63480, bug#67390

* lisp/files.el (permanently-enabled-local-variables): Add
  read-symbol-shorthands.

2 years agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 3 Feb 2024 11:49:53 +0000 (06:49 -0500)]
Merge from origin/emacs-29

b91f0ee2fcc ; Fix last change
2f69353e4a7 Fix incompatibility with tree-sitter-javascript >= 0.20.2
d49124fc14b Avoid signaling errors from 'pixel-fill-region'
a3987127618 eglot: Add nushell language server
5f56bc1cdfc eglot: Add php-ts-mode to eglot-server-programs
c14c978e3b1 Support kotlin-ts-mode in Eglot

2 years ago; Merge from origin/emacs-29
Eli Zaretskii [Sat, 3 Feb 2024 11:48:04 +0000 (06:48 -0500)]
; Merge from origin/emacs-29

The following commits were skipped:

caecbf3e8db Fix stale cache in Tramp  (do not merge with master)
5f3b46c61e2 * configure.ac: Include X11/Xlib.h for XOpenDisplay.  (Bu...

2 years agoMerge from origin/emacs-29
Eli Zaretskii [Sat, 3 Feb 2024 11:47:06 +0000 (06:47 -0500)]
Merge from origin/emacs-29

5ce02c91bc1 Improve `desktop-save-mode` docstring
2f98b13ed05 ; Fix doc strings of splash-screen data structures
77f5d4d523a Fix completing-read functional REQUIRE-MATCH behavior

2 years ago; Merge from origin/emacs-29
Eli Zaretskii [Sat, 3 Feb 2024 11:40:08 +0000 (06:40 -0500)]
; Merge from origin/emacs-29

The following commits were skipped:

c22d0ae2dd8 Fix "emacs -nw" on MS-Windows
396b49871aa ; Fix last change in package.texi

2 years agoFix downcasing of mode-name in compile.el
Eli Zaretskii [Sat, 3 Feb 2024 11:00:15 +0000 (13:00 +0200)]
Fix downcasing of mode-name in compile.el

* lisp/progmodes/compile.el (compilation--downcase-mode-name): New
function.
(compilation-start, kill-compilation): Use it instead of calling
'downcase' on 'mode-name'.  (Bug#68795)

2 years ago; * lisp/eshell/em-unix.el (eshell/cp, eshell/ln): Delete extra space.
Eli Zaretskii [Sat, 3 Feb 2024 09:52:30 +0000 (11:52 +0200)]
; * lisp/eshell/em-unix.el (eshell/cp, eshell/ln): Delete extra space.

Bug#68862.

2 years ago; Fix last change
Eli Zaretskii [Sat, 3 Feb 2024 09:20:11 +0000 (11:20 +0200)]
; Fix last change

* lisp/progmodes/js.el
(js--treesit-font-lock-compatibility-definition-feature): Fix
comments.

2 years agoFix incompatibility with tree-sitter-javascript >= 0.20.2
Vincenzo Pupillo [Thu, 1 Feb 2024 15:57:39 +0000 (16:57 +0100)]
Fix incompatibility with tree-sitter-javascript >= 0.20.2

Starting from version 0.20.2 the grammar's primary expression
"function" has been renamed to "function_expression".  A new
function checks if the new primary expression is available,
and if so, it returns the correct rules.
* lisp/progmodes/js.el
(js--treesit-font-lock-compatibility-definition-feature): New
function.
(js--treesit-font-lock-settings): Use it.  (Bug#68879)

2 years agoAvoid signaling errors from 'pixel-fill-region'
Eli Zaretskii [Sat, 3 Feb 2024 09:09:36 +0000 (11:09 +0200)]
Avoid signaling errors from 'pixel-fill-region'

* lisp/textmodes/pixel-fill.el (pixel-fill-region): Make sure the
selected window displays the current buffer.  This is important
when this function is called inside 'with-current-buffer' or
similar forms which temporarily change the buffer displayed in the
selected window.  (Bug#67791)

2 years agoPacify gcc -Wpointer-sign
Paul Eggert [Sat, 3 Feb 2024 06:53:23 +0000 (22:53 -0800)]
Pacify gcc -Wpointer-sign

* src/print.c (print_object): SDATA → SSDATA.

2 years agoReassociate erc-networks--id for orphaned queries
F. Jason Park [Wed, 31 Jan 2024 14:01:54 +0000 (06:01 -0800)]
Reassociate erc-networks--id for orphaned queries

* lisp/erc/erc-networks.el (erc-networks--examine-targets): Adopt the
server's network ID in query buffers created before MOTD's end.  Do
this to avoid a type error in the process filter when renaming
buffers.
* lisp/erc/erc-networks.el (erc-networks--examine-targets): New test.
* test/lisp/erc/erc-scenarios-base-upstream-recon-znc.el
(erc-scenarios-upstream-recon--znc/severed): New test.
* test/lisp/erc/erc-scenarios-misc.el
(erc-scenarios-base-mask-target-routing): Adjust timeout.
* test/lisp/erc/resources/base/upstream-reconnect/znc-severed.eld:
New file.
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests-common-make-server-buf): Use NAME parameter for creating
ID.

2 years agoFix local variable persistence in erc-stamp
F. Jason Park [Wed, 31 Jan 2024 02:17:41 +0000 (18:17 -0800)]
Fix local variable persistence in erc-stamp

* etc/ERC-NEWS: Mention renaming of `erc-munge-invisible-property'.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-disable): Remove
correct function from `erc-mode-hook'.
(erc-stamp--recover-on-reconnect): Revise doc string.
(erc-munge-invisibility-spec, erc-stamp--manage-local-options-state):
Mark former name as obsolete and rename to latter.  Don't use helper
macro meant only for local modules.  This bug originated from c68dc778
"Manage some text props for ERC insertion-hook members", which stemmed
from bug#60936.
(erc-stamp--setup, erc-hide-timestamps, erc-show-timestamps)
(erc-toggle-timestamps): Use new name for
`erc-munge-invisibility-spec'.
* lisp/erc/erc.el (erc--restore-initialize-priors): Raise error at
runtime if mode var doesn't belong to a local module.
* test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--insert-right)
(erc-timestamp-intangible--left): Use new name for
`erc-munge-invisibility-spec'.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Shadow
`erc-last-input-time'.
(erc--restore-initialize-priors): Add error form to expected
expansion, and skip test on Emacs 27.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--make-bindings): Shadow `erc-last-input-time'.

2 years agoTeach customize-option about erc-modules
F. Jason Park [Tue, 30 Jan 2024 03:04:58 +0000 (19:04 -0800)]
Teach customize-option about erc-modules

* lisp/erc/erc-goodies.el (erc-scrolltobottom-mode)
(erc-scrolltobottom-enable): Use `setq' instead of `setopt' because
the latter isn't defined in Emacs 27 and 28.  This fix is unrelated to
the main thrust of this commit.
* lisp/erc/erc.el (erc-modules): Make good on decades old language in
info node "(erc) Modules" by ensuring `customize-option' can find this
option before its containing library is loaded.  Like
`gnus-select-method', this option serves as an entry point for
configuring the application and is presented that way in tutorials and
library front matter.  Moreover, it can't be reasonably autoloaded in
the traditional way because of its many dependencies and large textual
footprint.
(erc-display-message): Revise doc string.

2 years agocperl-mode.el: Don't use obsolete `special-display-popup-frame`
Stefan Monnier [Fri, 2 Feb 2024 23:59:21 +0000 (18:59 -0500)]
cperl-mode.el: Don't use obsolete `special-display-popup-frame`

* lisp/progmodes/cperl-mode.el (cperl-info-on-command): Simplify,
to let `pop-to-buffer` decide whether to create a new frame or not,
so it can be controlled by `display-buffer-alist`.

2 years agobytecomp.el: Rewrite the way we print dynamic docstrings
Stefan Monnier [Wed, 31 Jan 2024 23:56:43 +0000 (18:56 -0500)]
bytecomp.el: Rewrite the way we print dynamic docstrings

We used to print dynamic docstrings "manually" for two reasons:

- References should look like `(#$ . POS)` but `prin1` was unable
  to print just `#$` for an sexp.
- `make-docfile` needed to find those docstrings and the object
  to which they belonged.

The second point is moot now that we don't use `make-docfile` on
`.elc` files.  So this patch lifts the first restriction,
using `print-number-table`.

The rest of the patch then simplifies and regularises the
bytecompiler's generation of dynamic docstrings, which can
now also easily be done for "inner" defvars and other places.

* src/print.c (print_preprocess, print_object): Handle strings in
`print-number-table`.
(Vprint_number_table): Improve docstring.

* lisp/emacs-lisp/bytecomp.el:
(byte-compile--list-with-n): New function.
(byte-compile--docstring-style-warn): Rename from
`byte-compile-docstring-style-warn` and change calling convention.
(byte-compile--\#$, byte-compile--docstrings): New vars.
(byte-compile-close-variables): Bind them.
(byte-compile--docstring): New function.
(byte-compile-from-buffer): Set `byte-compile--\#$`.
(byte-compile-output-file-form): Use `byte-compile--\#$` instead
of special casing specific forms.
(byte-compile--output-docform-recurse, byte-compile-output-docform):
Delete functions.
(byte-compile-file-form-autoload, byte-compile-file-form-defalias)
(byte-compile-file-form-defvar-function, byte-compile-lambda):
Use `byte-compile--docstring` and `byte-compile--list-with-n`.
(byte-compile--declare-var): Add optional `not-toplevel` arg.
(byte-compile-defvar): Add `toplevel` arg.  Use `byte-compile--docstring`.
(byte-compile-file-form-defvar): Delegate to `byte-compile-defvar`.
(byte-compile--custom-declare-face): New function.  Use it for
`custom-declare-face`.
(byte-compile-file-form-defmumble): Use `byte-compile-output-file-form`

* src/doc.c (Fdocumentation_stringp): New function.
(syms_of_doc): Defsubr it.
(store_function_docstring): Remove left-over code from when we
used DOC for the docstring of some Lisp files.

* lisp/cus-face.el (custom-declare-face): Accept dynamic docstrings.
* lisp/faces.el (face-documentation): Handle dynamic docstrings.
* lisp/help-fns.el (describe-face): Simplify accordingly.

2 years ago; * doc/lispref/sequences.texi (Sequence Functions): Fix typo.
Eli Zaretskii [Fri, 2 Feb 2024 16:33:54 +0000 (18:33 +0200)]
; * doc/lispref/sequences.texi (Sequence Functions): Fix typo.

2 years ago; And another fix...
Eli Zaretskii [Fri, 2 Feb 2024 15:48:28 +0000 (17:48 +0200)]
; And another fix...

2 years ago; Another fix of last change.
Eli Zaretskii [Fri, 2 Feb 2024 15:46:19 +0000 (17:46 +0200)]
; Another fix of last change.

2 years ago; Fix last change
Eli Zaretskii [Fri, 2 Feb 2024 15:39:23 +0000 (17:39 +0200)]
; Fix last change

* lisp/sort.el (sort-on): Doc fix.

* doc/lispref/sequences.texi (Sequence Functions): Fix description
of 'sort-on'.

2 years ago; Fix last change
Eli Zaretskii [Fri, 2 Feb 2024 13:27:25 +0000 (15:27 +0200)]
; Fix last change

* doc/lispref/sequences.texi (Sequence Functions): Improve
indexing of last change

2 years agoNew function 'sort-on'
Eli Zaretskii [Fri, 2 Feb 2024 13:24:55 +0000 (15:24 +0200)]
New function 'sort-on'

* lisp/sort.el (sort-on): New function.  Patch by John Wiegley
<jwiegley@gmail.com>.

* etc/NEWS:
* doc/lispref/sequences.texi (Sequence Functions): Document
'sort-on'.

2 years agoIncrease `emacs-lisp-docstring-fill-column` to 72
Stefan Kangas [Fri, 2 Feb 2024 11:28:54 +0000 (12:28 +0100)]
Increase `emacs-lisp-docstring-fill-column` to 72

Monitors are wider now than when these defaults were first set, and it
is useful to take better advantage of that, to fit text on fewer lines.
Yet, it has repeatedly been shown that overly long lines reduce
readability:
   "A reasonable guideline would be 55 to 75 characters per line."[1]

We also don't want to disfavor narrow displays, like mobile phones; a
more promising direction here might be to automatically word wrap
docstrings and make their maximum width customizable.  That might
require a new docstring format, however.

Bumping it by 7 characters, from 65 to 72, seems a reasonable compromise
for now.  Consideration was given to increasing it to 70 or 75, but 72
happens to be a commonly recommended maximum line width elsewhere (see
Fortran 66, Python docstrings, commit message recommendations, etc.),
and we might as well do the same.

This change was discussed in:
https://lists.gnu.org/r/emacs-devel/2022-07/msg00217.html

[1] "Optimal Line Length in Reading — A Literature Review", Nanavati and
    Bias, Visible Language, Vol. 39 No. 2 (2005).
    https://journals.uc.edu/index.php/vl/article/view/5765

* lisp/emacs-lisp/lisp-mode.el (emacs-lisp-docstring-fill-column):
* .dir-locals.el (fill-column, emacs-lisp-docstring-fill-column):
Bump default to 72.

2 years agoeglot: Add nushell language server
nibon7 [Wed, 17 Jan 2024 16:01:48 +0000 (00:01 +0800)]
eglot: Add nushell language server

* lisp/progmodes/eglot.el (eglot-server-programs): Add nushell
language server.  (Bug#68823)

2 years agoeglot: Add php-ts-mode to eglot-server-programs
Piotr Kwiecinski [Thu, 1 Feb 2024 13:02:20 +0000 (14:02 +0100)]
eglot: Add php-ts-mode to eglot-server-programs

* lisp/progmodes/eglot.el (eglot-server-programs): Add
php-ts-mode.  (Bug#68870)

Copyright-paperwork-exempt: yes

2 years agoSupport kotlin-ts-mode in Eglot
dalu [Thu, 1 Feb 2024 03:45:13 +0000 (11:45 +0800)]
Support kotlin-ts-mode in Eglot

* lisp/progmodes/eglot.el (eglot-server-programs): Support
kotlin-ts-mode.  (Bug#68865)

Copyright-paperwork-exempt: yes

2 years ago* lisp/simple.el (read-from-kill-ring): Ignore `read-only' text property.
Juri Linkov [Thu, 1 Feb 2024 17:16:37 +0000 (19:16 +0200)]
* lisp/simple.el (read-from-kill-ring): Ignore `read-only' text property.

Add `read-only' to the list of text properties removed from history items
(bug#68847).

2 years agoFix stale cache in Tramp (do not merge with master)
Michael Albinus [Thu, 1 Feb 2024 16:17:36 +0000 (17:17 +0100)]
Fix stale cache in Tramp  (do not merge with master)

* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band):
Flush file properties when needed.  (Bug#68805)

2 years ago* src/lread.c (bytecode_from_rev_list): Fix thinko
Stefan Monnier [Thu, 1 Feb 2024 16:08:56 +0000 (11:08 -0500)]
* src/lread.c (bytecode_from_rev_list): Fix thinko

2 years ago* src/lread.c (bytecode_from_rev_list): Re-group checks
Stefan Monnier [Thu, 1 Feb 2024 16:06:51 +0000 (11:06 -0500)]
* src/lread.c (bytecode_from_rev_list): Re-group checks

Bring together all the conditions for well-formedness of the resulting
bytecode object.

2 years ago* configure.ac: Include X11/Xlib.h for XOpenDisplay. (Bug#68842)
Ulrich Müller [Wed, 31 Jan 2024 07:49:36 +0000 (08:49 +0100)]
* configure.ac: Include X11/Xlib.h for XOpenDisplay.  (Bug#68842)

Do not merge to master.

2 years agoFix search error in woman.el
Thierry Volpiatto [Wed, 31 Jan 2024 13:54:16 +0000 (13:54 +0000)]
Fix search error in woman.el

* lisp/woman.el (woman-if-body): Avoid signaling an error
if "el }" is not found.  (Bug#68852)

2 years agoFix 'fill-paragraph' in 'yaml-ts-mode'
Graham Marlow [Tue, 30 Jan 2024 01:16:04 +0000 (17:16 -0800)]
Fix 'fill-paragraph' in 'yaml-ts-mode'

* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode--fill-paragraph):
Avoid 'fill-paragraph' when outside of block_scalar or comment
nodes.  (Bug#68781)

2 years agomacfont.m: Fix values for font widths and weights on macOS
Stanislav Yaglo [Mon, 12 Jun 2023 10:56:37 +0000 (11:56 +0100)]
macfont.m: Fix values for font widths and weights on macOS

* src/macfont.m (mac_font_get_glyphs_for_variants)
(macfont_variation_glyphs): Fix width values.  (Bug#64013)

2 years agoshr: Correct SVG attribute case
Sacha Chua [Fri, 26 Jan 2024 13:54:03 +0000 (08:54 -0500)]
shr: Correct SVG attribute case

* lisp/net/shr.el (shr-correct-attribute-case): New constant.
(shr-correct-dom-case): New function to correct SVG attribute case.
(shr-tag-svg): Correct SVG attribute cases before using them.

2 years ago; * doc/emacs/basic.texi (Continuation Lines): Rearrange pxref.
Po Lu [Thu, 1 Feb 2024 08:25:09 +0000 (16:25 +0800)]
; * doc/emacs/basic.texi (Continuation Lines): Rearrange pxref.

2 years ago* src/term.c (produce_glyphs): Synchronize with gui_produce_glyphs.
Po Lu [Thu, 1 Feb 2024 08:18:53 +0000 (16:18 +0800)]
* src/term.c (produce_glyphs): Synchronize with gui_produce_glyphs.

2 years agoPrevent continuation from affecting tab width in/after line prefix
Po Lu [Thu, 1 Feb 2024 08:16:09 +0000 (16:16 +0800)]
Prevent continuation from affecting tab width in/after line prefix

* src/dispextern.h (struct it) <wrap_prefix_width>: New field,
synchronized with current_x when producing glyphs for wrap
prefixes, and subtracted from it->current_x when computing tab
widths.

* src/term.c (produce_glyphs): Set wrap_prefix_width.

* src/xdisp.c (start_display, display_min_width, move_it_to)
(move_it_vertically_backward, move_it_by_lines)
(window_text_pixel_size, display_tab_bar_line)
(display_tool_bar_line, redisplay_internal, redisplay_window)
(try_window_id, insert_left_trunc_glyphs)
(extend_face_to_end_of_line, display_line)
(Fmove_point_visually): Set or clear wrap_prefix_width as
appropriate.
(gui_produce_glyphs): Set or clear it->wrap_prefix_width.  When
computing the base position of a tab character, do not subtract
the continuation line width if a line prefix is the current
iterator method.  Subtract the wrap_prefix_width otherwise, in
order that the width of the tab is computed free of influence
from the wrap prefix.

2 years agoImprove `desktop-save-mode` docstring
Stefan Kangas [Thu, 1 Feb 2024 08:08:19 +0000 (09:08 +0100)]
Improve `desktop-save-mode` docstring

* lisp/desktop.el (desktop-save-mode): Improve docstring.

2 years agoIntroduce a global variant of visual-wrap-prefix-mode
Po Lu [Thu, 1 Feb 2024 08:08:47 +0000 (16:08 +0800)]
Introduce a global variant of visual-wrap-prefix-mode

* doc/emacs/basic.texi (Continuation Lines):

* etc/NEWS:

* lisp/visual-wrap.el (visual-wrap-prefix-mode): Document this
new global minor mode.
(global-visual-wrap-prefix-mode): New global minor mode.

2 years ago; hierarchy-tests.el: keep doc string within 80 columns
Mattias Engdegård [Wed, 31 Jan 2024 16:50:30 +0000 (17:50 +0100)]
; hierarchy-tests.el: keep doc string within 80 columns

2 years agoBytecode engine fast-path streamlining of plain symbols
Mattias Engdegård [Wed, 31 Jan 2024 16:35:59 +0000 (17:35 +0100)]
Bytecode engine fast-path streamlining of plain symbols

* src/bytecode.c (exec_byte_code):
Only use fast-path optimisations for calls and dynamic variable
reference and setting where the symbol is plain, which is much faster.

2 years agoEliminate lazy bytecode loading
Mattias Engdegård [Tue, 30 Jan 2024 16:55:19 +0000 (17:55 +0100)]
Eliminate lazy bytecode loading

The obsolete lazy-loaded bytecode feature, enabled by
`byte-compile-dynamic`, slows down Lisp execution even when not in use
because every call to a bytecode function has to check that function
for laziness.

This change forces up-front loading of all lazy bytecode so that we
can remove all those checks.  (Dynamically loaded doc strings are not
affected.)

There is no point in generating lazy bytecode any more so we stop
doing that; this simplifies the compiler.  `byte-compile-dynamic` now
has no effect.

This is a fully compatible change; the few remaining users of
`byte-compile-dynamic` should not notice any difference.

* src/lread.c (bytecode_from_rev_list): Force eager loading of
lazy bytecode.
* src/bytecode.c (exec_byte_code): Remove lazy bytecode checks.
* src/eval.c (fetch_and_exec_byte_code, Ffetch_bytecode): Remove.
(funcall_lambda): Call exec_byte_code directly, avoiding checks.
* lisp/subr.el (fetch-bytecode): New definition, obsolete no-op.
* lisp/emacs-lisp/disass.el (disassemble-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-unfold-bcf):
Remove calls to fetch-bytecode.
(byte-compile-dynamic): Update doc string.
(byte-compile-close-variables, byte-compile-from-buffer)
(byte-compile-insert-header, byte-compile-output-file-form)
(byte-compile--output-docform-recurse, byte-compile-output-docform)
(byte-compile-file-form-defmumble):
Remove effects of byte-compile-dynamic.
* doc/lispref/compile.texi (Dynamic Loading): Remove node now that
the entire `byte-compile-dynamic` facility has been rendered inert.
* etc/NEWS: Announce changes.

2 years agoAllow equal user-defined hash table tests with different names
Mattias Engdegård [Wed, 31 Jan 2024 11:21:12 +0000 (12:21 +0100)]
Allow equal user-defined hash table tests with different names

Hash tables using different user-defined tests defined identically
sometimes ended up using the wrong test (bug#68668).

* src/fns.c (get_hash_table_user_test): Take test name into account
when matching the test object.
* test/src/fns-tests.el (fns--define-hash-table-test): New.

2 years agoDon't hang when display objects are displaced by line or wrap-prefixes
Po Lu [Wed, 31 Jan 2024 06:34:19 +0000 (14:34 +0800)]
Don't hang when display objects are displaced by line or wrap-prefixes

This fixes a hang that would frequently rear its ugly head while
displaying messages in the `telega.el' instant messenger client,
which inserts images approaching the width of the window with
line and wrap prefixes.

* src/xdisp.c (move_it_in_display_line_to): If a line or wrap
prefix is set in place, do not generate continuation lines until
a minimum of one glyph has been produced outside that prefix.
(move_it_to): Remove the previous workaround that could not
recover from errors caused by display strings.
(display_line): Synchronize with move_it_in_display_line_to;
remove old workaround that only provided for oversized wrap
prefixes comprising `space' display objects.

2 years agoFix treesit--indent-1 regarding local parsers
Yuan Fu [Wed, 31 Jan 2024 06:18:33 +0000 (22:18 -0800)]
Fix treesit--indent-1 regarding local parsers

Take this code as an example:

1 class Foo
2 {
3     /**
4      * Block comment
5      */
6     function foo($c) {
7     }
8 }

Suppose the block comment is covered by a local parser.  When we
indent line 3, treesit--indent-1 will try to get the local parser at
the BOL, and it'll get the local parser.  But it shouldn't use the
local parser to indent this line, it should use the host parser of
that local parser instead.

So now, if treesit--indent-1 gets a local parser, but the local
parser's root node's start coincides with BOL, treesit--indent-1 will
use the host parser to indent this line.

We also need to make treesit--update-ranges-local to save the host
parser along with the local parser, and make
treesit-local-parsers-at/on extract and return the host parser.

I also switch the two cases in the cond form in treesit--indent-1:
(null (treesit-parser-list)) and (car local-parsers), (car
local-parsers) now takes precedence.

* lisp/treesit.el (treesit-local-parsers-at):
(treesit-local-parsers-on): Add WITH-HOST parameter.
(treesit--update-ranges-local): Save the host parser to the local
overlay.
(treesit--indent-1): If the root node of the local parser is at BOL,
use the host parser instead.

2 years agoUpdate from Gnulib by running admin/merge-gnulib
Paul Eggert [Wed, 31 Jan 2024 01:22:50 +0000 (17:22 -0800)]
Update from Gnulib by running admin/merge-gnulib

2 years ago; Spelling fixes
Paul Eggert [Wed, 31 Jan 2024 01:09:37 +0000 (17:09 -0800)]
; Spelling fixes

2 years ago* lisp/emacs-lisp/inline.el (inline-const-val): Improve docstring
Stefan Monnier [Tue, 30 Jan 2024 18:14:32 +0000 (13:14 -0500)]
* lisp/emacs-lisp/inline.el (inline-const-val): Improve docstring

2 years ago; Rename a lexical variable in vhdl-mode.el
Eli Zaretskii [Tue, 30 Jan 2024 14:15:59 +0000 (16:15 +0200)]
; Rename a lexical variable in vhdl-mode.el

* lisp/progmodes/vhdl-mode.el (vhdl-speedbar-insert-hierarchy):
Rename a variable to avoid shadowing a global.  (Bug#68810)

2 years agoFix typo in Eshell's "du" command
Jim Porter [Tue, 30 Jan 2024 01:33:35 +0000 (17:33 -0800)]
Fix typo in Eshell's "du" command

This option is supposed to be "--si", for "International System of
Units", not "--is".

* lisp/eshell/em-unix.el (eshell/du): Change "is" to "si".

2 years agoderived.el: Delete old code (bug#68625)
Stefan Monnier [Tue, 30 Jan 2024 00:04:59 +0000 (19:04 -0500)]
derived.el: Delete old code (bug#68625)

* lisp/emacs-lisp/derived.el (derived-mode-setup-function-name)
(derived-mode-init-mode-variables, derived-mode-set-keymap)
(derived-mode-set-syntax-table, derived-mode-set-abbrev-table)
(derived-mode-run-hooks, derived-mode-merge-keymaps)
(derived-mode-merge-syntax-tables, derived-mode-merge-abbrev-tables):
Delete functions.

2 years ago(byte-compile): Try and make it a bit more readable
Stefan Monnier [Mon, 29 Jan 2024 23:56:19 +0000 (18:56 -0500)]
(byte-compile): Try and make it a bit more readable

* lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function):
Use `macroexp-parse-body` and only handle closures.
(byte-compile): Clarify the control and data flow a bit.

2 years ago* Better type comparison in comp tests
Andrea Corallo [Mon, 29 Jan 2024 20:18:12 +0000 (21:18 +0100)]
* Better type comparison in comp tests

* test/src/comp-tests.el (comp-tests--type-lists-equal): New function.
(comp-tests--types-equal): Handle function types.

2 years ago; * lisp/minibuffer.el (minibuffer-visible-completions): Doc fix.
Eli Zaretskii [Mon, 29 Jan 2024 19:21:50 +0000 (21:21 +0200)]
; * lisp/minibuffer.el (minibuffer-visible-completions): Doc fix.

2 years ago; Fix doc strings of splash-screen data structures
Eli Zaretskii [Mon, 29 Jan 2024 12:56:40 +0000 (14:56 +0200)]
; Fix doc strings of splash-screen data structures

* lisp/startup.el (fancy-startup-text, fancy-about-text): Doc
fixes.  (Bug#68788)

2 years agoFix 'calc-math-read-preprocess-string' test (bug#66944).
Daniel Brooks [Sun, 28 Jan 2024 08:17:50 +0000 (00:17 -0800)]
Fix 'calc-math-read-preprocess-string' test (bug#66944).

Copyright-paperwork-exempt: yes

2 years ago; * src/sfnt.c: Fix standalone compilation.
Po Lu [Mon, 29 Jan 2024 12:28:31 +0000 (20:28 +0800)]
; * src/sfnt.c: Fix standalone compilation.

2 years ago* src/haiku_select.cc: Include stdckdint.h.
Po Lu [Mon, 29 Jan 2024 12:17:26 +0000 (12:17 +0000)]
* src/haiku_select.cc: Include stdckdint.h.

2 years ago; Spelling fixes
Paul Eggert [Mon, 29 Jan 2024 08:20:09 +0000 (00:20 -0800)]
; Spelling fixes

2 years agoDon't open a new line for long defuns being inserted at column 0
Po Lu [Mon, 29 Jan 2024 07:45:47 +0000 (15:45 +0800)]
Don't open a new line for long defuns being inserted at column 0

* lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Don't
open a new line for long defuns at column 0.

* test/lisp/vc/log-edit-tests.el
(log-edit-fill-entry-space-substitution): Adjust expected
results to match change.
(log-edit-fill-entry-initial-wrapping): New test.

2 years ago* exec/configure.ac (OPENAT_SYSCALL): Define on MIPS.
Po Lu [Mon, 29 Jan 2024 03:54:46 +0000 (11:54 +0800)]
* exec/configure.ac (OPENAT_SYSCALL): Define on MIPS.

2 years ago; * test/lisp/vc/log-edit-tests.el: Pacify compiler warnings.
Po Lu [Mon, 29 Jan 2024 03:01:33 +0000 (11:01 +0800)]
; * test/lisp/vc/log-edit-tests.el: Pacify compiler warnings.

2 years agoPrevent filling from mangling ChangeLog defun lists
Po Lu [Mon, 29 Jan 2024 02:54:49 +0000 (10:54 +0800)]
Prevent filling from mangling ChangeLog defun lists

* lisp/vc/log-edit.el (log-edit-fill-entry): Replace space
characters within defun lists with NBSPs for the duration of
`fill-region''s execution, so that they are never considered
break points.

* test/lisp/vc/log-edit-tests.el
(log-edit-fill-entry-space-substitution): New test.

2 years agoIn Eshell, don't expand quoted tildes into a user's home directory
Jim Porter [Sun, 3 Sep 2023 05:29:22 +0000 (22:29 -0700)]
In Eshell, don't expand quoted tildes into a user's home directory

* lisp/eshell/em-dirs.el (eshell-parse-user-reference): Don't expand
quoted tildes.

* test/lisp/eshell/em-dirs-tests.el
(em-dirs-test/expand-user-reference/local)
(em-dirs-test/expand-user-reference/quoted): New tests.

2 years agoIn Eshell, allow an escaped newline at the end of a command
Jim Porter [Sun, 28 Jan 2024 23:49:03 +0000 (15:49 -0800)]
In Eshell, allow an escaped newline at the end of a command

Normally, "echo<RET>" runs the command "echo".  Likewise,
"echo\<RET><RET>" should too: we escape the first newline, and then
the second one is unescaped and should send the command input to
Eshell.  Previously, you had to press RET a third time, but now it
works as expected.

* lisp/eshell/esh-arg.el (eshell-looking-at-backslash-return): Make
obsolete.
(eshell-parse-backslash): A backslash sequence is only incomplete if
there's nothing at all after it.

* test/lisp/eshell/esh-arg-tests.el (esh-arg-test/escape/newline)
(esh-arg-test/escape-quoted/newline): Remove inaccurate comment;
escaped newlines are always special.
(esh-arg-test/escape/trailing-newline): New test.

2 years agoxt-mouse.el: Obey `mouse-wheel-*-event` variables (bug#68698)
Stefan Monnier [Sun, 28 Jan 2024 23:51:11 +0000 (18:51 -0500)]
xt-mouse.el: Obey `mouse-wheel-*-event` variables (bug#68698)

* lisp/xt-mouse.el (xterm-mouse--same-button-p): New function.
(xterm-mouse--read-event-sequence): Use it to obey
`mouse-wheel-*-event` variables.
* lisp/mwheel.el (mouse-wheel-obey-old-style-wheel-buttons):
Update docstring.

2 years agoFix completing-read functional REQUIRE-MATCH behavior
Joseph Turner [Sun, 12 Nov 2023 21:21:50 +0000 (13:21 -0800)]
Fix completing-read functional REQUIRE-MATCH behavior

* lisp/minibuffer.el (completion--complete-and-exit): If
minibuffer-completion-confirm is a function which returns nil,
immediately fail to complete.

See bug#66187.

2 years ago; Fix typos
Stefan Kangas [Sun, 28 Jan 2024 15:59:50 +0000 (16:59 +0100)]
; Fix typos

2 years agoFix "emacs -nw" on MS-Windows
Eli Zaretskii [Sun, 28 Jan 2024 08:19:48 +0000 (10:19 +0200)]
Fix "emacs -nw" on MS-Windows

* src/w32term.c (w32_flip_buffers_if_dirty): Do nothing if F is
not a GUI frame.  This avoids rare crashes in "emacs -nw".
* src/w32console.c (initialize_w32_display): Set the
ENABLE_EXTENDED_FLAGS bit in 'prev_console_mode'.

(cherry picked from commit e1970c99f097715fc5bb3b88154799bfe13de90f)

2 years ago; Fix last change in package.texi
Eli Zaretskii [Sun, 28 Jan 2024 05:43:25 +0000 (07:43 +0200)]
; Fix last change in package.texi

* doc/lispref/package.texi (Multi-file Packages): Fix wording and
markup.  (Bug#65027)

(cherry picked from commit 6d76e3991241905b0841effc6f8cd42394d9aa64)

2 years agoMerge from origin/emacs-29
Michael Albinus [Sun, 28 Jan 2024 10:51:51 +0000 (11:51 +0100)]
Merge from origin/emacs-29

e11c9f9c6e8 Handle wrong login program in Tramp

# Conflicts:
# lisp/net/tramp-sh.el

2 years ago; Merge from origin/emacs-29
Michael Albinus [Sun, 28 Jan 2024 10:49:59 +0000 (11:49 +0100)]
; Merge from origin/emacs-29

The following commits were skipped:

b2db82c5aec * doc/lispref/package.texi (Multi-file Packages): Documen...
3c2baa1b954 Avoid signaling errors in emoji.el on empty input

2 years agoHandle wrong login program in Tramp
Michael Albinus [Sun, 28 Jan 2024 09:31:45 +0000 (10:31 +0100)]
Handle wrong login program in Tramp

* lisp/net/tramp-sh.el (tramp-maybe-open-connection): Exit remote
shell when login fails.

2 years ago; * lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Fix typos.
Po Lu [Sun, 28 Jan 2024 09:08:50 +0000 (17:08 +0800)]
; * lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Fix typos.

2 years ago; Correct typo
Po Lu [Sun, 28 Jan 2024 08:55:56 +0000 (16:55 +0800)]
; Correct typo

* lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Correct
typo in alignment constants.

2 years ago; New log-edit tests
Po Lu [Sun, 28 Jan 2024 08:55:33 +0000 (16:55 +0800)]
; New log-edit tests

* test/lisp/vc/log-edit-tests.el
(log-edit-fill-entry-confinement): Test confinement in various
contrived scenarious.

2 years agoImprove filling of ChangeLog entries
Po Lu [Sun, 28 Jan 2024 08:31:33 +0000 (16:31 +0800)]
Improve filling of ChangeLog entries

* lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Rewrite
completely.
(log-edit-fill-entry): Abandon pcase and cl-lib.

2 years agoPrefer C23 ckd_* to Gnulib *_WRAPV and *_OK macros
Paul Eggert [Sun, 28 Jan 2024 08:15:38 +0000 (00:15 -0800)]
Prefer C23 ckd_* to Gnulib *_WRAPV and *_OK macros

* src/alloc.c (android_make_lisp_symbol) [HAVE_ANDROID && !__clang__]:
* src/android.c (android_blit_copy, android_blit_xor)
(android_get_image):
* src/androidmenu.c (android_menu_show):
* src/androidselect.c (Fandroid_get_clipboard_data)
(android_notifications_notify_1):
* src/androidterm.c (android_decode_utf16)
(android_text_to_string):
* src/haiku_select.cc (be_display_notification):
* src/sfnt.c (sfnt_read_cmap_format_8, sfnt_read_cmap_format_12)
(sfnt_read_cmap_format_14, sfnt_read_cmap_table_1)
(sfnt_expand_compound_glyph_context, sfnt_poly_edges_exact)
(sfnt_read_meta_table, sfnt_read_ttc_header)
(sfnt_read_cvt_table, sfnt_read_fpgm_table)
(sfnt_read_prep_table, sfnt_make_interpreter)
(sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_2)
(sfnt_interpret_compound_glyph, sfnt_read_default_uvs_table)
(sfnt_read_nondefault_uvs_table, sfnt_create_uvs_context)
(sfnt_read_fvar_table, sfnt_read_gvar_table)
(sfnt_read_avar_table, sfnt_read_cvar_table):
* src/sfntfont-android.c (GET_SCANLINE_BUFFER):
* src/textconv.c (really_commit_text, really_set_composing_text)
(really_replace_text, get_surrounding_text):
Prefer C2x stdckdint.h macros to intprops.h macros.

2 years agoRename TAG_PTR to TAG_PTR_INITIALLY
Paul Eggert [Sun, 28 Jan 2024 08:15:38 +0000 (00:15 -0800)]
Rename TAG_PTR to TAG_PTR_INITIALLY

* src/lisp.h (TAG_PTR_INITIALLY): Rename from TAG_PTR, since calls
can be used only as initializers, and the convention elsewhere in
lisp.c is to give these macros names ending in ‘_INITIALLY’.
This should help avoid confusion such as we recently experienced
in make_lisp_symbol_internal.  All uses changed.

2 years ago* src/lisp.h: Improve TAG_PTR comments.
Paul Eggert [Sun, 28 Jan 2024 08:15:38 +0000 (00:15 -0800)]
* src/lisp.h: Improve TAG_PTR comments.

2 years agoFix C conformance issue in LISPSYM_INITIALLY
Paul Eggert [Sun, 28 Jan 2024 08:15:38 +0000 (00:15 -0800)]
Fix C conformance issue in LISPSYM_INITIALLY

* src/lisp.h (LISPSYM_INITIALLY): Remove unnecessary cast to char *.
The C standard allows but does not require support for casts to
pointers in constant expressions in static initializers.